﻿// <copyright file="MultiPoint.cs" company="Signal Processing Lab, Wuhan University">
// Copyright (c) 2009-2010 All Right Reserved
// </copyright>
// <author>Xinping Deng</author>
// <email>dentoby@gmail.com</email>
// <date>2010-4</date>
// <summary>This is part of Image.NET project.</summary>

namespace SPLWHU.Core.Vectors
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// The point collection.
    /// </summary>
    public class MultiPoint : MultiGeometry<Point2d>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MultiPoint"/> class.
        /// </summary>
        public MultiPoint()
            : base()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="MultiPoint"/> class by specifying a list of points.
        /// </summary>
        /// <param name="points">The points.</param>
        public MultiPoint(List<Point2d> points)
            : base(points)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="MultiPoint"/> class by specifying an array of points.
        /// </summary>
        /// <param name="points">The points.</param>
        public MultiPoint(params Point2d[] points)
            : base(points)
        {
        }

        /// <summary>
        /// Gets the corresponding wkb geometry type (<see cref="GeometryType"/>).
        /// </summary>
        /// <value>An int represents the wkb geometry type.</value>
        public override int TypeFlag
        {
            get { return (int)GeometryType.MultiPoint; }
        }

        /// <summary>
        /// Creates a new geometry and adds it to this instance.
        /// </summary>
        /// <returns>The geometry created.</returns>
        public override Geometry CreateGeometry()
        {
            Point2d p = new Point2d();
            this.Add(p);

            return p;
        }

        /// <summary>
        /// Creates a copy of this geometry.
        /// </summary>
        /// <returns>The copy of this geometry.</returns>
        public override Geometry Clone()
        {
            MultiPoint cpy = new MultiPoint();
            foreach (Point2d p in this)
            {
                cpy.Add(new Point2d(p));
            }

            return cpy;
        }
    }
}
